package com.congwulin.wechat.controller;

import com.congwulin.wechat.entity.product.Product;
import com.congwulin.wechat.entity.product.ProductType;
import com.congwulin.wechat.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping(value = "product")
public class ProductController {
    @Autowired
    private ProductService service;

    @RequestMapping(value = "saveProduct", method = RequestMethod.POST)
    public @ResponseBody
    List<Product> saveProduct(@RequestBody List<Product> products){
        return service.saveProduct(products);
    }

    @RequestMapping(value = "saveProductType", method = RequestMethod.POST)
    public @ResponseBody
    List<ProductType> saveProductType(@RequestBody List<ProductType> productTypes){
        return service.saveProductType(productTypes);
    }
}
